package ar.edu.itba.it.paw.web;

import java.io.IOException;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import ar.edu.itba.it.paw.domain.Product;
import ar.edu.itba.it.paw.services.ProductServices;
import ar.edu.itba.it.paw.services.impl.ProductServicesImpl;

@SuppressWarnings("serial")
public class ViewProduct extends HttpServlet {

	protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException{

		int id = Integer.valueOf(req.getParameter("id"));
		ProductServices services = ProductServicesImpl.getInstance();
		Product product = null;
		product = services.getProduct(id);

		req.setAttribute("product", product);
		req.getRequestDispatcher("/WEB-INF/jsp/viewProduct.jsp").forward(req, resp);
	}
	
	
}
